package com.example.consumptionrecords.entity.enums;

/**
 * 孙敬佳
 * 2023 \ 08 \ 29
 */

public enum TwelveAnimals {
    RAT(0, "rat"),
    CATTLE(1, "cattle"),
    TIGER(2, "tiger"),
    RABBIT(3, "rabbit"),
    DRAGON(4, "dragon"),
    SNAKE(5, "snake"),
    HORSE(6, "horse"),
    SHEEP(7, "sheep"),
    MONKEY(8, "monkey"),
    CHICKEN(9, "chicken"),
    DOG(10, "dog"),
    PIG(11, "pig");

    private final Integer num;

    private final String animals;

    TwelveAnimals(Integer num, String animals) {
        this.num = num;
        this.animals = animals;
    }

    public Integer getNum() {
        return num;
    }

    public String getAnimals() {
        return animals;
    }

    public static String match(Integer key) {
        for (TwelveAnimals value : values()) {
            if (value.getNum().equals(key)) {
                return value.getAnimals();
            }
        }
        return null;
    }
}
